<template>
	<view class="box">
		<view v-for="(item,index) in literatureData" :key="item.id" @click="detailClick(item.id)">
			<view>
				<!-- item.cover.path -->
				<image :src="item.cover.path"></image>
			</view>
			<view>
				<view>{{item.name}}</view>
				<view>{{item.introduce}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		uniNavigateTo
	} from "@/util/index.js";
	export default {
		name: "LiteratureList",
		props: {
			literatureData: {
				type: Array,
				default: [],
			},
		},
		data() {
			return {

			};
		},
		methods: {
			detailClick(id) {
				uniNavigateTo(`/pages/literature/literatureDetail?id=${id}`)
			}
		}
	}
</script>

<style lang="scss" scoped>
	.box {
		width: 100%;

		>view {
			background: #fff;
			box-sizing: border-box;
			padding: 10rpx;
			box-shadow: 0.53333vw 0.53333vw 1.06667vw rgba(0, 0, 0, 0.1);
			margin-top: 20rpx;
			display: flex;
			align-items: center;
			border-radius: 12rpx;

			>view:first-of-type {
				max-width: 220rpx;
				width: 220rpx;
				border: 1px solid #aaa;
				margin-right: 20rpx;

				>image {
					display: block;
					width: 100%;
					height: 220rpx;
				}
			}

			>view:last-of-type {
				width: calc(100% - 220rpx - 20rpx);
				max-width: calc(100% - 220rpx - 20rpx);

				>view:first-of-type {
					font-size: 36rpx;
					max-width: 93vw;
					font-weight: 900;
					white-space: nowrap;
					overflow: hidden;
					text-overflow: ellipsis;
					margin-bottom: 20rpx;
				}

				>view:last-of-type {
					font-size: 26rpx;
					color: #666;
					margin: 0;
					margin-top: 1.6vw;
					overflow: hidden;
					text-overflow: ellipsis;
					-webkit-line-clamp: 3;
					-webkit-box-orient: vertical;
					display: -webkit-box;
				}
			}
		}
	}
</style>
